<?php
    require_once 'public/includes/functions.php';
    require_once 'models/container.php';
    
    class IndexController extends functions {
        
        var $container =null;
        var $breakPage = null;
        
        function __construct(){
            $this->container = new Container_Model();            
        }
        
        function listContainer($currentPage){
            $row = 5;
            $list = array();
            if(empty($currentPage)|| $currentPage==1) $currentPage = 0; 
            $total = mysql_num_rows($this->container->ExecuteTable("container"));
            $start = $currentPage*$row;
            $sql = "select * from container ORDER BY ID Desc LIMIT $start,{$row}";
            $res = $this->container->ExecuteSQL($sql);
            while($rs=mysql_fetch_array($res)){
	            $idbaiviet=$rs['ID'];
    			$name=$rs['name'];
    			$gioithieu=$rs['gioithieu'];
    			$anh=$rs['anh'];
    			//echo $anh; 
				$list[] = "<div class='noidung'>
					           <div class='part'>
				                    <a href='./?rt=page&?id=$idbaiviet'>
                                        <img src='upload/images/$anh' class='hinhbaiviet' width='178' height ='185'/>
                                    </a>
				                    <img src='public/images/logobaiviet.png' class ='logobaiviet'/>
                                    <a href='./?rt=page&id=$idbaiviet'><h3 class='tieude'> $name </h3>
                                    </a>
				                    <p>  $gioithieu  </p>
				                    <a href='./?rt=page&id=$idbaiviet' class='tieptuc' title='Đọc tiếp'> >>> 
                                    </a>								
				                </div>			            					
			             </div>";
        //			<!-- end div nội dung-->	
            }
            
            $this->breakPage = $this->divPage($total,$currentPage,3,$row,'','');
            
            return $list;
        }
        
        public function indexAtion(){
            
        }
    }
    
    // thuc thi class
    $index = new IndexController();
    $index->show('index');
?>